## Create Figure A3

## Load packages
library(tidyverse)

vote_vals = c(rep(15:100, each = 2))
turnout_vals = c(rep(c(6.57, 22.66), 86))

vote_dta = read.table("bmp_vote_turnout_probs.txt") %>%
  bind_cols(., vote_vals, turnout_vals) %>%
  rename(received_est = V2, received_se = V3,
         vote = ...5)


figureA3 = ggplot(vote_dta) +
  geom_ribbon(aes(x=vote_vals, ymin=received_est - 1.96 * received_se, 
                  ymax=received_est + 1.96 * received_se, fill = factor(turnout_vals)), alpha=0.2) +
  geom_line(aes(x=vote_vals, y=received_est, color = factor(turnout_vals))) +
  geom_hline(yintercept=0, linetype="dashed", color = "darkgray") +
  geom_vline(xintercept=50, linetype="dashed", color = "darkgray") +
  scale_color_manual(values = c("red4", "blue4"), name = "Turnout",
                     labels = c("6.57%", "22.66%")) + 
  scale_fill_manual(values = c("red4", "blue4"), name = "Turnout",
                    labels = c("6.57%", "22.66%")) +
  scale_x_continuous(labels = c("0%", "25%", "50%", "75%", "100%")) +
  labs(x = "Vote Share", y = "Pr(Received BMP Project)") +
  theme_bw() +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_rect(colour = "black"),
        legend.position = "bottom")